<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>注册页面</title>
<link rel="shortcut icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/amazeui.min.css" />
<link href="${pageContext.request.contextPath}/css/dlstyle.css" rel="stylesheet" type="text/css">
<script src="${pageContext.request.contextPath}/js/jquery.js"></script>
<style type="text/css">
	.res-banner{
		background-image: url('${pageContext.request.contextPath}/images/logbig.jpg');
		background-size: cover;
		background-repeat: no-repeat;
		width: 1442px;
		margin: 0 auto;
	}
</style>
</head>
<body>
${msg }
		<div class="res-banner">
			<div class="login-boxtitle">
				<a href="${pageContext.request.contextPath}/goods/firstQuery"><img alt="" src="${pageContext.request.contextPath}/images/logo.png" /></a>
			</div>
			<div class="res-main">
				<div class="login-box">
						<div class="am-tabs" id="doc-my-tabs">
							<ul class="am-tabs-nav am-nav am-nav-tabs am-nav-justify">
								<li class="am-active"><a href="">用户注册</a></li>
							</ul>
							<div class="am-tabs-bd">
								<div class="am-tab-panel am-active">
									<form method="post" id="registForm">
									    <div class="user-email">
												<input type="text" name="username" id="username" placeholder="请输入用户账号">
		                 				</div>										
		                                <div class="user-pass">
										    <input type="password" name="password" id="password" placeholder="设置密码">
		                                </div>										
		                                <div class="user-pass">
										    <input type="password" name="passwordRepeat" id="passwordRepeat" placeholder="确认密码">
		                                </div>	
	                 					<div style="text-align: center">
							               	用户:<input style="width: 50px;height: 18px;margin-top: 10px;margin-left: 0px;" type="radio" name="sex" checked="checked" value="1" />
							               	商户:<input style="width: 50px;height: 18px;" type="radio" name="sex"  value="0" />
		               					</div>
										 <div class="am-cf">
											<input type="submit" id="submit" value="注册" class="am-btn am-btn-primary am-btn-sm am-fl">
										 </div>
										 </form>
										 <div class="login-links">
												<label for="reader-me">
													<div id="jsvalidate" style="color:red"></div>
												</label>
									  	 </div>
									
								</div>
								<script type="text/javascript">
									$(function() {
									    $('#doc-my-tabs').tabs();
									  })
									  
									function $(id){
										return document.getElementById(id);
									}
									var username = $("username");
									
									var password = $("password");
									var passwordRepeat = $("passwordRepeat");
									var jsvalidate = $("jsvalidate");
									var submit = $("submit");
									
									username.onblur = function(){
										if(this.value=='' || this.value.length<6 || this.value.length>18){
											jsvalidate.innerHTML='账号不能为空且长度要在6至18位之间!';
										}else{
											jsvalidate.innerHTML='';
										}
									}
									
									password.onblur = function(){
										if(this.value=='' || this.value.length<6 || this.value.length>18){
											jsvalidate.innerHTML='密码不能为空且长度要在6至18位之间!';
										}else{
											jsvalidate.innerHTML='';
										}
									}
									
									passwordRepeat.onblur = function(){
										if(this.value != password.value){
											jsvalidate.innerHTML = '密码不一致!';
											
										}else if(this.value == '' || this.value.length<6 || this.value.length>18){
											jsvalidate.innerHTML='密码不能为空且长度要在6至18位之间!';
										}else{
											jsvalidate.innerHTML = '';
										}
									}
									
									submit.onclick = function(){
										if(username.value=='' || username.value.length<6 || username.value.length>18 || password.value=='' || password.value.length<6 || password.value.length>18 || passwordRepeat.value=='' || passwordRepeat.value.length<6 || passwordRepeat.value.length>18 || password.value!=passwordRepeat.value){
											jsvalidate.innerHTML = '请输入正确的信息格式!';
										}else{
											$("registForm").action='${pageContext.request.contextPath}/saleAccount/registValidate';
											$("registForm").submit;
										}
									}
								</script>

							</div>
						</div>
				</div>
			</div>
		</div>
</body>
</html>